package com.puzzlebazar.client.puzzle.model;

import com.puzzlebazar.client.main.control.GenericController;
import com.puzzlebazar.client.puzzle.control.PuzzleController;
import com.puzzlebazar.client.puzzle.view.ExtPuzzleView;
import com.puzzlebazar.client.squaregrid.view.SGViewImpl;
import com.puzzlebazar.client.util.BoundInfo;
import com.puzzlebazar.client.util.Vec2i;

public interface PuzzleFactory {

	/**
	 * This method returns a new model constructed using the passed custom properties
	 * 
	 * @return The newly created puzzle model
	 * @throws Exception
	 */
	public PuzzleModel newModel() throws Exception;
	
	/**
	 * This method returns a newly created view to associate with the model 
	 * 
	 * @param puzzleModel The model associated to this view
	 * @return The newly created view
	 * @throws Exception
	 */
	public SGViewImpl createView(PuzzleModel puzzleModel) throws Exception;

	/**
	 * This method returns a newly constructed controller associated with the given model and view
	 * 
	 * @param model The model associated with this controller
	 * @param history The history to use (can be null)
	 * @param moveTimer The move timer
	 * @param view The view associated with this controller
	 * @param parentController The parent of this subcontroller
	 * @return The newly created controller
	 * @throws Exception
	 */
	public PuzzleController createController(PuzzleModel model, History history, MoveTimer moveTimer,
			ExtPuzzleView view, GenericController parentController) throws Exception;

	/**
	 * @return The bound information for the minimum and maximum size of this puzzle
	 */
	public BoundInfo getBoundInfo();
	
	/**
	 * @return The default size this puzzle should use
	 */
	public Vec2i getDefaultSize();
}
